package java3_BasicSyntax;

import java.util.LinkedList;

//泛型和数组
public class ArraysAndGenerics {
    public static void main(String[] args) {
        ArraysAndGenerics arraysAndGenerics = new ArraysAndGenerics();
        arraysAndGenerics.arrays();
        arraysAndGenerics.Generics();

    }

    //int类型的数字
    void arrays() {
        int[] ints = new int[3];
        ints[0] = 1;
        ints[1] = 2;
        ints[2] = 3;
        for (int i = 0; i < ints.length; i++) {
            System.out.println(ints[i]);
        }
    }

    //    String泛型的LinkedList
    void Generics() {
        LinkedList<String> strings = new LinkedList<>();
        strings.add("1st");
        strings.add("2nd");
        for (int i = 0; i < strings.size(); i++) {
            System.out.println(strings.get(i));
        }
    }
}
